home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWMaping.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  8.0 KB  |  271 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWMaping.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWMAPING_H
  11. #define FWMAPING_H
  12.  
  13. #ifndef SLGRDEF_H
  14. #include "SLGrDef.h"
  15. #endif
  16.  
  17. #ifndef SLPTRECT_H
  18. #include "SLPtRect.h"
  19. #endif
  20.  
  21. #ifndef SLMAPING_H
  22. #include "SLMaping.h"
  23. #endif
  24.  
  25. #ifndef FWPOINT_H
  26. #include "FWPoint.h"
  27. #endif
  28.  
  29. #ifndef FWRECT_H
  30. #include "FWRect.h"
  31. #endif
  32.  
  33. // ----- Foundation Includes -----
  34.  
  35. #ifndef FWEXCLIB_H
  36. #include "FWExcLib.h"
  37. #endif
  38.  
  39. //========================================================================================
  40. //    class FW_CMapping
  41. //========================================================================================
  42.  
  43. class FW_CMapping : public FW_SMapping
  44. {
  45.  
  46. //----------------------------------------------------------------------------------------
  47. //    Constructors/Destructors
  48. //
  49. public:
  50.     FW_DECLARE_AUTO(FW_CMapping)
  51.  
  52.     FW_CMapping(FW_EMappingModes mappingMode = FW_kPoint);
  53.     FW_CMapping(const FW_CMapping& mapping);
  54.     FW_CMapping(const FW_SMapping& mapping);
  55.  
  56.     ~FW_CMapping();
  57.  
  58. //----------------------------------------------------------------------------------------
  59. //    operators
  60. //
  61. public:
  62.     FW_CMapping&    operator= (const FW_CMapping& mapping);
  63.     FW_CMapping&    operator= (const FW_SMapping& mapping);
  64.     
  65.     FW_Boolean        operator==(const FW_CMapping& mapping) const;
  66.     FW_Boolean        operator!=(const FW_CMapping& mapping) const;
  67.  
  68. //----------------------------------------------------------------------------------------
  69. //    New API
  70. //
  71. public:
  72.     
  73.     // ----- Setting the mapping -----
  74.  
  75.     void        Reset(Environment* ev)
  76.         { FW_PrivMapping_Reset(*this, ev); }
  77.     
  78.     void        SetMappingMode(Environment* ev, FW_EMappingModes newMappingMode)
  79.         { FW_PrivMapping_SetMode(*this, ev, newMappingMode); }
  80.         
  81.     void        SetExtents(Environment* ev,
  82.                             const FW_CPoint& logicalExtent,
  83.                             const FW_CPoint& deviceExtent)
  84.         { FW_PrivMapping_SetExtents(*this, ev, logicalExtent, deviceExtent); }
  85.     
  86.     FW_CPoint    GetLogicalExtent() const
  87.         { return fLogicalExtent; }
  88.                     
  89.     FW_CPoint    GetDeviceExtent() const
  90.         { return fDeviceExtent; }
  91.     
  92.     void        SetDeviceOrigin(Environment* ev, FW_Fixed x, FW_Fixed y)
  93.         { FW_PrivMapping_SetDeviceOrigin(*this, ev, x, y); }
  94.         
  95.     void        SetLogicalOrigin(Environment* ev, FW_Fixed x, FW_Fixed y)
  96.         { FW_PrivMapping_SetLogicalOrigin(*this, ev, x, y); }
  97.     
  98.     FW_CPoint    GetDeviceOrigin() const
  99.         { return fDeviceOrg; }
  100.                     
  101.     FW_CPoint    GetLogicalOrigin() const
  102.         { return fLogicalOrg; }
  103.  
  104. //----------------------------------------------------------------------------------------
  105. //    Conversion methods: delegated
  106. //
  107. public:
  108.     
  109.     // ----- Logical ---> Content
  110.  
  111.     void                    LogicalToContent(
  112.                                 Environment* ev,
  113.                                 const FW_SPoint& ptFrom,
  114.                                 FW_SPoint& ptTo,
  115.                                 FW_HGDevice device,
  116.                                 ODTransform* transform = NULL) const
  117.         { FW_PrivMapping_LogicalToContentPoint(*this, ev, ptFrom, ptTo, device, transform); }
  118.  
  119.     void                    LogicalToContent(
  120.                                 Environment* ev,
  121.                                 const FW_SRect& rectFrom,
  122.                                 FW_SRect& rectTo,
  123.                                 FW_HGDevice device,
  124.                                 ODTransform* transform = NULL) const
  125.         { FW_PrivMapping_LogicalToContentRect(*this, ev, rectFrom, rectTo, device, transform); }
  126.     
  127.     ODShape*                LogicalToContent(
  128.                                 Environment* ev,
  129.                                 ODShape* shape,
  130.                                 FW_HGDevice device,
  131.                                 ODTransform* transform = NULL) const
  132.         { return FW_PrivMapping_LogicalToContentShape(*this, ev, shape, device, transform); }                                
  133.  
  134.     // ----- Logical ---> Device
  135.  
  136.     void                    LogicalToDevice(
  137.                                 Environment* ev,
  138.                                 const FW_SPoint& ptFrom,
  139.                                 FW_SPlatformPoint& ptTo,
  140.                                 FW_HGDevice device,
  141.                                 ODTransform* transform = NULL) const
  142.         { FW_PrivMapping_LogicalToDevicePoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  143.  
  144.     void                    LogicalToDevice(
  145.                                 Environment* ev,
  146.                                 const FW_SRect& rectFrom,
  147.                                 FW_SPlatformRect& rectTo,
  148.                                 FW_HGDevice device,
  149.                                 ODTransform* transform = NULL) const
  150.         { FW_PrivMapping_LogicalToDeviceRect(*this, ev, rectFrom, rectTo, device, transform); }                                
  151.  
  152.     ODShape*                LogicalToDevice(
  153.                                 Environment* ev,
  154.                                 ODShape* shape,
  155.                                 FW_HGDevice device,
  156.                                 ODTransform* transform) const
  157.         { return FW_PrivMapping_LogicalToDeviceShape(*this, ev, shape, device, transform); }                                
  158.  
  159.     // ----- Device ---> Logical
  160.  
  161.     void                    DeviceToLogical(
  162.                                 Environment* ev,
  163.                                 const FW_SPlatformPoint& ptFrom,
  164.                                 FW_SPoint& ptTo,
  165.                                 FW_HGDevice device,
  166.                                 ODTransform* transform = NULL) const
  167.         { FW_PrivMapping_DeviceToLogicalPoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  168.     
  169.     void                    DeviceToLogical(
  170.                                 Environment* ev,
  171.                                 const FW_SPlatformRect& rectFrom,
  172.                                 FW_SRect& rectTo,
  173.                                 FW_HGDevice device,
  174.                                 ODTransform* transform = NULL) const
  175.         { FW_PrivMapping_DeviceToLogicalRect(*this, ev, rectFrom, rectTo, device, transform); }
  176.  
  177.     ODShape*                DeviceToLogical(
  178.                                 Environment* ev,
  179.                                 ODShape* shape,
  180.                                 FW_HGDevice device,
  181.                                 ODTransform* transform = NULL) const
  182.         { return FW_PrivMapping_DeviceToLogicalShape(*this, ev, shape, device, transform); }                                
  183.  
  184.     // ----- Device ---> Content
  185.  
  186.     void                    DeviceToContent(
  187.                                 Environment* ev,
  188.                                 const FW_SPlatformPoint& ptFrom,
  189.                                 FW_SPoint& ptTo,
  190.                                 FW_HGDevice device,
  191.                                 ODTransform* transform = NULL) const
  192.         { FW_PrivMapping_DeviceToContentPoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  193.     
  194.     void                    DeviceToContent(
  195.                                 Environment* ev,
  196.                                 const FW_SPlatformRect& rectFrom,
  197.                                 FW_SRect& rectTo,
  198.                                 FW_HGDevice device,
  199.                                 ODTransform* transform = NULL) const
  200.         { FW_PrivMapping_DeviceToContentRect(*this, ev, rectFrom, rectTo, device, transform); }                                
  201.     
  202.     ODShape*                DeviceToContent(
  203.                                 Environment* ev,
  204.                                 ODShape* shape,
  205.                                 FW_HGDevice device,
  206.                                 ODTransform* transform = NULL) const
  207.         { return FW_PrivMapping_DeviceToContentShape(*this, ev, shape, device, transform); }                                
  208.  
  209.  
  210.     // ----- Content ---> Logical
  211.                             
  212.     void                    ContentToLogical(
  213.                                 Environment* ev,
  214.                                 const FW_SPoint& ptFrom,
  215.                                 FW_SPoint& ptTo,
  216.                                 FW_HGDevice device,
  217.                                 ODTransform* transform = NULL) const
  218.         { FW_PrivMapping_ContentToLogicalPoint(*this, ev, ptFrom, ptTo, device, transform); }                                
  219.     
  220.     void                    ContentToLogical(
  221.                                 Environment* ev,
  222.                                 const FW_SRect& rectFrom,
  223.                                 FW_SRect& rectTo,
  224.                                 FW_HGDevice device,
  225.                                 ODTransform* transform = NULL) const
  226.         { FW_PrivMapping_ContentToLogicalRect(*this, ev, rectFrom, rectTo, device, transform); }                                
  227.  
  228.     ODShape*                ContentToLogical(
  229.                                 Environment* ev,
  230.                                 ODShape* shape,
  231.                                 FW_HGDevice device,
  232.                                 ODTransform* transform = NULL) const
  233.         { return FW_PrivMapping_ContentToLogicalShape(*this, ev, shape, device, transform); }
  234.  
  235.     // ----- Content ---> Device
  236.  
  237.     void                    ContentToDevice(
  238.                                 Environment* ev,
  239.                                 const FW_SPoint& ptFrom,
  240.                                 FW_SPlatformPoint& ptTo,
  241.                                 FW_HGDevice device,
  242.                                 ODTransform* transform = NULL) const
  243.         {     FW_PrivMapping_ContentToDevicePoint(*this, ev, ptFrom, ptTo, device, transform); }                        
  244.     
  245.     void                    ContentToDevice(
  246.                                 Environment* ev,
  247.                                 const FW_SRect& rectFrom,
  248.                                 FW_SPlatformRect& rectTo,
  249.                                 FW_HGDevice device,
  250.                                 ODTransform* transform = NULL) const
  251.         { FW_PrivMapping_ContentToDeviceRect(*this, ev, rectFrom, rectTo, device, transform); }
  252.     
  253.     ODShape*                ContentToDevice(
  254.                                 Environment* ev,
  255.                                 ODShape* shape,
  256.                                 FW_HGDevice device,
  257.                                 ODTransform* transform = NULL) const
  258.         { return FW_PrivMapping_ContentToDeviceShape(*this, ev, shape, device, transform); }
  259. };
  260.  
  261. //----------------------------------------------------------------------------------------
  262. //    FW_CMapping::operator!=
  263. //----------------------------------------------------------------------------------------
  264.  
  265. inline FW_Boolean FW_CMapping::operator!=(const FW_CMapping& mapping) const
  266. {
  267.     return !(*this == mapping);
  268. }
  269.  
  270. #endif
  271.